package java_9_12;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;

/*
输入生日（月-日），计算距离生日还有多少天（考虑2-29的特殊情况)
*/
public class Test_10 {
    public static void main(String[] args)  {
        Scanner in=new Scanner(System.in);
        System.out.println("请输出生日；月-日");
        Calendar c=Calendar.getInstance();
        int days=0;
        SimpleDateFormat s=new SimpleDateFormat("yyyy-MM-dd");
        String n = in.next();
        Calendar c1=Calendar.getInstance();
        try {
            c1.setTime(s.parse(n));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        c1.set(Calendar.YEAR,c.get(Calendar.YEAR));
        if (c1.get(Calendar.DAY_OF_YEAR)<c.get(Calendar.DAY_OF_YEAR)){
          days=c.getActualMaximum(Calendar.DAY_OF_YEAR)-c.get(Calendar.DAY_OF_YEAR);
          days+=c1.get(Calendar.DAY_OF_YEAR);
        }else{
            days=c1.get(Calendar.DAY_OF_YEAR)-c.get(Calendar.DAY_OF_YEAR);
        }
        System.out.println(days);
    }
}
